package cn.iot.utils;

import java.util.List;

public class Page<T> {
    private Integer pageNo=1;
    private Integer pageSize=5;
    private Integer totalCount=0;
    private Integer totalPageCount=1;
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        if (pageNo>0) {
            this.pageNo = pageNo;
        }
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        if (pageSize>0) {
            this.pageSize = pageSize;
        }
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        if (totalCount>0) {
            this.totalCount = totalCount;
            this.setTotalPageCount();
        }
    }

    public Integer getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount() {
        if(totalCount%pageSize==0){
            this.totalPageCount = totalCount/pageSize;
        }else {
            this.totalPageCount = totalCount/pageSize+1;
        }
    }
}
